<template>
	<view class="content">
		<view class="row b-b">
			<text class="tit">原登陆密码</text>
			<input class="input" type="text" password="true" v-model="login_password" placeholder="登陆密码" placeholder-class="placeholder" />
		</view>
		<view class="row b-b">
			<text class="tit">新登陆密码</text>
			<input class="input" type="number" password="true"  v-model="password" placeholder="新登陆密码" placeholder-class="placeholder" />
		</view>
		<button class="add-btn" @click="confirm">提交</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				password:'',
				login_password:''
			}
		},
		methods: {
			confirm(){
				if(this.login_password==''){
					this.$api.msg("请输入原登陆密码")
					return 
				}
				if(this.password==''){
					this.$api.msg("请输入新登陆密码")
					return 
				}
				let _this=this
				this.$http.sendRequest({
					url:"api/member/modifyLoginPassword",
					method:"POST",
					data:{login_password:_this.login_password,password:_this.password},
					success:function(res){
						if(res.data.code==0){
							_this.$api.msg(res.data.message)
							setTimeout(function(){
								uni.reLaunch({
									url:"../../pages/user/user"
								})
							},2000)
							
						}else{
							_this.$api.msg(res.data.message)
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background: $page-color-base;
		padding-top: 16upx;
	}

	.row{
		display: flex;
		align-items: center;
		position: relative;
		padding:0 30upx;
		height: 110upx;
		background: #fff;
		
		.tit{
			flex-shrink: 0;
			width: 120upx;
			font-size: 30upx;
			color: $font-color-dark;
		}
		.input{
			flex: 1;
			font-size: 30upx;
			color: $font-color-dark;
		}
		.icon-shouhuodizhi{
			font-size: 36upx;
			color: $font-color-light;
		}
	}
	.default-row{
		margin-top: 16upx;
		.tit{
			flex: 1;
		}
		switch{
			transform: translateX(16upx) scale(.9);
		}
	}
	.add-btn{
		display: flex;
		align-items: center;
		justify-content: center;
		width: 690upx;
		height: 80upx;
		margin: 60upx auto;
		font-size: $font-lg;
		color: #fff;
		background-color: $base-color;
		border-radius: 10upx;
		box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
	}
</style>
